use std::io;

use djon::Value;

fn main() -> io::Result<()> {
    let val = djon::list![
        Value::ident("foobar"),
        Value::boolean(true),
        Value::integer(114514),
        Value::real(1919.81),
        Value::string("Hello, world!"),
        Value::pair(Value::ident("Key"), Value::string("Value")),
        Value::Nil
    ];

    let mut buf = [0u8; 512];
    let len = val.write_bin(&mut buf.as_mut_slice())?;

    let buffer = Vec::from(&buf[..len]);

    let new = Value::read_bin(&mut buffer.as_slice())?;

    println!("{new:?}");

    Ok(())
}
